package com.base.pig.controller;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.base.pig.entity.AlarmSensor;
import com.base.pig.entity.CameraInfo;
import com.base.pig.entity.PskInfo;
import com.base.pig.service.CameraInfoService;
import com.base.pig.service.PskInfoService;
import com.base.pig.util.LechangeHttpSend;
import com.base.pig.util.NlLechangeHttpSend;
import com.base.pig.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Api(tags = "内涝监测站视频接口")
@RestController
@RequestMapping("/cameraApi")
public class CameraApiController {

    @Autowired
    public CameraInfoService cameraInfoService;

    @ApiOperation("查询摄像头列表")
    @PostMapping("/queryCameraList")
    public R queryCameraList(){
        List<CameraInfo> list = cameraInfoService.list(Wrappers.<CameraInfo>query().lambda().orderByAsc(CameraInfo::getId));
        return R.ok(list);
    }



    @ApiOperation("根据设备sncode查询摄像头信息")
    @PostMapping("/queryCameraInfo")
    public R queryCameraInfo(@RequestParam("sncode") String sncode){
        CameraInfo cameraInfo = cameraInfoService.getOne(Wrappers.<CameraInfo>query().lambda().eq(CameraInfo::getSncode,sncode));
        return R.ok(cameraInfo);
    }





}
